﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SameGame.Presentation;

namespace SameGame
{
	public partial class MainWindow : Window, IMainView
	{
		private IMainPresenter _mainPresenter;

		public MainWindow()
		{
			InitializeComponent();
			this.Loaded += MainWindow_Loaded;
		}

		void MainWindow_Loaded(object sender, RoutedEventArgs e)
		{
			_mainPresenter = PresentationFactory.CreateMainPresenter(this);

			IBoardPresenter boardPresenter = _mainPresenter.CreateBoardPresenter();
			BoardUserControl boardUserControl = new BoardUserControl(boardPresenter);
			contentBoard.Content = boardUserControl;

			IBoardScorePresenter scorePresenter = _mainPresenter.CreateScorePresenter();
			ScoreView scoreView = new ScoreView(scorePresenter);
			menu.Items.Add(scoreView);

			IBoardBallsStatisticPresenter statisticPresenter = _mainPresenter.CreateBoardBallsStatisticPresenter();
			BallsStatisticUserControl statistic = new BallsStatisticUserControl(statisticPresenter);
			menu.Items.Add(statistic);
		}

		public Presentation.Size Size
		{
			get
			{
				return new Presentation.Size() { X = 10, Y = 10 };
			}
		}

		private void MenuItem_Click_1(object sender, RoutedEventArgs e)
		{
			_mainPresenter.OnStartNewGame();
		}

		private void MenuItem_Click_2(object sender, RoutedEventArgs e)
		{

		}
	}
}
